package com.zcxy.bean;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Component
public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
    //初始化相关的，改造相关beandefinition。
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        // TODO Auto-generated method stub
        System.out.println("我是postProcessBeanFactory--执行了postProcessBeanFactory方法");

        BeanDefinition beanDefinition = beanFactory.getBeanDefinition("initBean");
        System.out.println("修改属性name值");
        beanDefinition.getPropertyValues().add("name", "liSi");






    }

}
